//
//  main.swift
//  ClosureDemo
//
//  Created by zhangjianyun on 17/6/27.
//  Copyright © 2017年 com.taihejiacheng. All rights reserved.
//

import Foundation

var arr = [20, 9,100,34,89,39]

func hasClosureMatch(arr: [Int], value: Int, cb: (_ num: Int, _ value: Int)->Bool) -> Bool {
    for item in arr {
        if (cb(item, value)) {
            return true
        }
    }
    return false
}

var v1 = hasClosureMatch(arr: arr, value: 40) { (num : Int, value : Int) -> Bool in
    return num >= value
}
print("v1 is \(v1)")

var v2 = hasClosureMatch(arr: arr, value: 8) { (num: Int, value: Int) -> Bool in
    return num < value
}
print("v2 is \(v2)")

		
